package com.seari.web.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.seari.bean.LineInfo;
import com.seari.pojo.MessageBean;
import com.seari.service.LineService;

/**
 * 线路
 * @author liuqi
 *
 */
@RestController
public class LineController {

	@Autowired
	private LineService lineService;
	
	/**
	 * 线路列表信息
	 * @return
	 */
	@RequestMapping(value = "/line/getLineInfo")
	public MessageBean getLineListInfo() {

		MessageBean messageBean = new MessageBean();
		try {
			Map<String, Object> dataMap = new HashMap<String, Object>();
			
			List<LineInfo> lineInfoList = lineService.getLineListInfo();
			dataMap.put("lineInfoList", lineInfoList);
					
			messageBean.setType("success");
			messageBean.setCode("1000");
			messageBean.setMessage("线路列表信息获取成功 ");
			messageBean.setData(dataMap);
		} catch (Exception e) {
			e.printStackTrace();
			messageBean.setType("fail");
			messageBean.setCode("3000");
			messageBean.setMessage("线路列表信息获取失败");
		}

		return messageBean;
	}
}
